package com.czx.dagger2demo;

import android.util.Log;

import dagger.Component;

/**
 * TODO: Add a class header comment!
 */
@PoetryScope
@Component(dependencies = ApplicationComponent.class,modules = ActivityModule.class)
public abstract class ActivityComponent {
    private static final String TAG = "ActivityComponent";
    abstract void inject(MainActivity mainActivity);

    abstract void inject(Main2Activity main2Activity);

    private static ActivityComponent sComponent;
    public static ActivityComponent getInstance(){
        Log.e(TAG, "getInstance: ");
        if(sComponent==null){
            DaggerActivityComponent.builder()
                    .applicationComponent(MyApp.getInstance().getApplicationCOmponent())
                    .build();
        }
        return sComponent;
    }
}
